home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / filesyst / ncpfs / mars_dos.000 / mars_dos / netpc / nwtests.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-22  |  1.7 KB  |  68 lines

  1. /* nwtests.c 20-May-96 */
  2.  
  3. /****************************************************************
  4.  * (C)opyright (C) 1993,1996  Martin Stover, Marburg, Germany   *
  5.  ****************************************************************/
  6.  
  7. #include "net.h"
  8.  
  9. #include <fcntl.h>
  10. #include <share.h>
  11.  
  12.  
  13. static int usage(void)
  14. {
  15.   return(-1);
  16. }
  17.  
  18. int func_tests_1(int argc, char *argv[], int mode)
  19. {
  20.   int level     = ncp_17_02(NWCONN, 6);
  21.   int dirhandle = alloc_temp_dir_handle(0, "SYS:", 'd', NULL);
  22.   int result    = -1;
  23.   uint8  *path  = (argc < 2) ? "SYS:\\TMP" : argv[1];
  24.   if (dirhandle > -1) {
  25.     result = ncp_16_02(dirhandle, "SYSTEM/", NULL, NULL, NULL, NULL);
  26.     result = ncp_16_02(dirhandle, "SYSTEM", NULL, NULL, NULL, NULL);
  27.   }
  28.   fprintf(stdout, "dirhandle=%d, result=%d\n", dirhandle, result);
  29.   result = redir_device_drive(0x4, "u:", path);
  30.   fprintf(stdout, "redir path=%s, result=%d\n", path, result);
  31.  
  32.   path="Q1";
  33.   result = redir_device_drive(0x3, "LPT1", path);
  34.   fprintf(stdout, "redir path=%s, result=%d\n", path, result);
  35.  
  36.   {
  37.     int k =-1;
  38.     uint8 devname[20];
  39.     uint8 remotename[130];
  40.     int  devicetyp;
  41.     while ((result = list_redir(++k, &devicetyp, devname, remotename)) > -1){
  42.        fprintf(stdout, "index=%d, dev=%s(%d), %s result=%d\n",
  43.             k, devname, devicetyp, remotename, result);
  44.     }
  45.   }
  46.   if (level > -1) (void) ncp_17_02(NWCONN, level);
  47.   return(0);
  48. }
  49.  
  50. static void tesopen(int mode)
  51. {
  52.   int fd = _rtl_open("xyzzz", mode);
  53.   if (fd > -1) close(fd);
  54. }
  55.  
  56.  
  57. int func_tests(int argc, char *argv[], int mode)
  58. {
  59.   int level     = ncp_17_02(NWCONN, 6);
  60.  
  61.   tesopen(O_RDONLY);
  62.   tesopen(O_RDONLY | SH_COMPAT);
  63.   tesopen(O_RDWR);
  64.   tesopen(O_RDWR   | SH_COMPAT);
  65.   if (level > -1) (void) ncp_17_02(NWCONN, level);
  66.   return(0);
  67. }
  68.